package com.dgut.sales.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dgut.sales.bean.Contract;
import com.dgut.sales.bean.Details;
import com.dgut.sales.dao.ContractDao;
import com.dgut.sales.dynamic.sql.bean.ContractSearch;

@Service
public class ContractService {
	@Autowired
	private ContractDao dao;
	
	public List<Contract> getAllContract(){
		return dao.getAllContract();
	}
	
	public Contract getContractById(Integer id) {
		return dao.getContractById(id);
	}
	
	public void updateContract(Contract contract) {
		dao.update(contract);
	}

	public void delete(Integer id) {
		dao.delete(id);
	}
	public List<Map<String, Details>> getContractDetails(Integer id){
		return dao.getContractDetails(id);
	}
	
	public void addContract(Contract contract) {
		dao.addContract(contract);
	}

	public List<Contract> searchContract(ContractSearch contractSearch) {
		return dao.searchContract(contractSearch);
	} 
}
